package com.naiyumie.ncalculator;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.naiyumie.nlib.NMath;
import com.naiyumie.nlib.NWidgetTool;
import com.naiyumie.nlib.Nlog;

public class KingWangJjangActivity extends Activity implements OnClickListener {
	
	Nlog nlog = new Nlog();
	NWidgetTool nWidgetTool = new NWidgetTool();
	NMath nMath = new NMath();
	TextView tvTitle = null;
	Button prevBtn = null;
	ImageView aboutBtn = null;
	String msg = null;
	
	public String getMsg() {
		return msg;
	}
	
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}
	
	public void callMethod() {
		nlog.puts("callMethod init");
		aboutBtn = (ImageView) findViewById(R.id.aboutBtn);
		prevBtn = (Button) findViewById(R.id.prevBtn);
		prevBtn.setOnClickListener(titleBarAction);
		tvTitle = (TextView) findViewById(R.id.tvTitle);
		tvTitle.setText(R.string.category02);
		tvTitle.setOnClickListener(titleBarAction);
		aboutBtn.setOnClickListener(titleBarAction);
	}
	
	//타이틀바 액션
	View.OnClickListener titleBarAction = new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			nlog.puts("click action > " + v.getId());
			switch (v.getId()) {
				case R.id.prevBtn:
				case R.id.tvTitle:
					prevBack();
					break;
				case R.id.aboutBtn:
					Intent intent = new Intent(getApplicationContext(), HelperActivity.class);
					intent.putExtra("MSG", getMsg());
					startActivityForResult(intent, 1200);
					break;
				default:
					break;
			}
		}
	};
	
	@Override
	public void onClick(View v) {
	}
	
	// 뒤로를 누름
	public void prevBack() {
		this.finish();
	}
}
